#!/bin/sh

set -e

echo "Removing unwanted packages"

### Deinstall dev packages.

# We use apt-get as aptitude doesn't know about globs.
# There are packages we could be tempted to remove but we can't:
#   - gcc-*-base (libstdc++6 depends on it)
#   - libgcc1 (apt depends on it)
#   - cpp, cpp-* (big parts of GNOME depend on it)
apt-get --yes purge  \
   '^linux-kbuild-*' \
   '^linux-headers-*' \
   '^linux-headers-*:amd64' \
   '^linux-source-*' \
   build-essential debhelper dkms dpkg-dev \
   gcc gcc-4.8 gcc-4.8-base gcc-4.9 \
   intltool-debian \
   libc6-dev libgl1-mesa-dev linux-libc-dev \
   make \
   po-debconf \
   rsyslog \
   libdvdcss-dev \
   equivs virtualbox-guest-dkms

### Deinstall a few unwanted packages that were pulled by tasksel
### since they have Priority: standard.
apt-get --yes purge  \
   apt-listchanges at bsd-mailx dc debian-faq doc-debian \
   '^exim4*' ftp m4 mlocate mutt ncurses-term nfs-common portmap procmail \
   python-reportbug reportbug telnet texinfo time w3m wamerican

### Deinstall some other unwanted packages.
apt-get --yes purge  \
    '^aptitude*' \
    '^geoclue*' \
    krb5-locales \
    live-build \
    locales \
    rpcbind \
    tasksel \
    tasksel-data \

### Deinstall dependencies of the just removed packages.
apt-get --yes --purge autoremove
